package com.hexingmo.dawn.lang;

import java.math.BigInteger;

public class IPNumber {

    private final long longValue;
    private final BigInteger bigIntValue;
    private final IPVersion version;

    public IPNumber(long longValue, java.math.BigInteger bigIntValue, IPVersion version) {
        this.longValue = longValue;
        this.bigIntValue = bigIntValue;
        this.version = version;
    }

    public long getLongValue() { return longValue; }
    public BigInteger getBigIntValue() { return bigIntValue; }
    public IPVersion getVersion() { return version; }

    @Override
    public String toString() {
        if (version == IPVersion.IPv4) {
            return "IPv4: " + longValue;
        } else {
            return "IPv6: " + bigIntValue;
        }
    }
}
